import { HideAndSeekGame } from "@/hideAndSeek/game";
import { HideAndSeekModes } from "@/hideAndSeek/modes";
import { kcqdGame } from "@/kcqd/kcqdGame";
import { Player, world } from "@minecraft/server";
import { Game } from "@sapi-game/main";
import { KcpdMaps } from "../maps";

interface KcpdGame {
    name: string;
    onStart: (players: Player[], time: number) => void;
    /**红石信号强度 */
    power: number;
}

interface time {
    time: number;
    power: number;
}

export const KcpdGames: KcpdGame[] = [
    {
        name: "躲猫猫",
        onStart: (players, time) => {
            Game.manager.startGame(HideAndSeekGame, {
                time: time,
                map: KcpdMaps.station,
                mode: HideAndSeekModes.classic,
                players: players,
            });
        },
        power: 1,
    },
    {
        name: "烤肠争夺赛",
        onStart: (players, time) => {
            Game.manager.startGame(kcqdGame, {
                players: players,
                map: KcpdMaps.station,
            });
        },
        power: 5,
    },
    {
        name: "烤肠躲猫猫(感染)",
        onStart: (players, time) => {
            Game.manager.startGame(HideAndSeekGame, {
                time: time,
                map: KcpdMaps.parking,
                mode: HideAndSeekModes.infectionMode,
                players: players,
            });
        },
        power: 10,
    },
    {
        name: "炸串店",
        onStart: (players, time) => {
            world.sendMessage(players.map((p) => p.name).join(","));
            world.sendMessage("炸串店" + time);
        },
        power: 15,
    },
];

export const KcpdTimes: time[] = [
    { time: 300, power: 1 },
    { time: 400, power: 5 },
    { time: 500, power: 10 },
    { time: 600, power: 15 },
];
